home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gwu / error.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-30  |  2.1 KB  |  80 lines

  1. /*
  2.     GWAda Development Environment for 386/486 PCs   
  3.     Copyright (C) 1993, Arthur Vargas Lopes  & Michael Bliss Feldman
  4.                         vlopes@vortex.ufrgs.br mfeldman@seas.gwu.edu
  5.  
  6.     This program is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation; version 2 of the License.    
  9.  
  10.  
  11.     This program is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     GNU General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU General Public License
  17.     along with this program; if not, write to the Free Software
  18.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20.  
  21. /* error.c */
  22.  
  23. #include "externs.h"
  24.  
  25.  
  26. void AVL_ERROR(char *s)
  27. {
  28.     AVL_WIN_PTR win;
  29.     short cor;
  30.     int ch, n1, n2;
  31.     struct rccoord old;
  32.     char msgs[3][77];
  33.     int i, j = 0, k = 0;
  34.     AVL_EDIT_WINDOW_PTR w;
  35.     w = &avl_windows[avl_window];
  36.     if (w -> line_no != 0)  {
  37.         for(i = 0; i < strlen(s); ++i) {
  38.             if (*(s+i) == '\n' ||  j > 75) {
  39.                 msgs[k][j++] = '\0';
  40.                 j = 0;
  41.                 k++;
  42.                 }
  43.             msgs[k][j++] = *(s+i);
  44.             }
  45.         msgs[k][j] = '\0';
  46.         }
  47.     else 
  48.         strcpy(msgs[k],s);
  49.     n1 = strlen(s) + 10;
  50.     if (n1 > 77) n1 = 80;
  51.     n2 = (80 - n1) / 2;
  52.     if (n2 <= 0) n2 = 1;
  53.     if ((n1 + n2) >= 80) n2 = 0;
  54.     win = AVL_MAKE_WINDOW(" Error Report ",7,n2,7+k+2,n1+n2,avl_wnd_bk_color,avl_wnd_color);
  55.     cor = _settextcolor(avl_err_color);
  56.     for(i = 0; i <= k; ++i)  {
  57.         _settextposition(2+i,2);
  58.         _outtext(msgs[i]);
  59.         }
  60.     AVL_PAUSE(20);
  61.     AVL_DEL_WINDOW(win);
  62. }
  63.  
  64. void AVL_PAUSE(short l)
  65. {
  66.     static char *cont = "Press any key to continue ...";
  67.     int ch, n1, n2;
  68.     AVL_WIN_PTR w;
  69.     n1 = strlen(cont);
  70.     n1 += 2;
  71.     n2 = (80 - n1) - 5;
  72.     w = AVL_MAKE_WINDOW("",l,n2,l+2,n1+n2+1,avl_wnd_bk_color,avl_wnd_color);
  73.     _setbkcolor(avl_msg_bk_color);
  74.     _settextcolor(avl_msg_color);
  75.     _settextposition(1,2);
  76.     _outtext(cont);
  77.     ch = getch();
  78.     if (ch == 0) ch = getch();
  79.     AVL_DEL_WINDOW(w);
  80. }
  81.